package com.umeng.analytics.pro;

import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;
import java.util.BitSet;
import java.util.Collections;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class bp implements cg, Serializable, Cloneable {
    static class a extends dp {
        private a() {

        }

        public void a(df arg5, bp arg6) throws cm {
            arg5.j();
            while (true) {
                da v0 = arg5.l();
                if (v0.b == 0) {
                    break;
                }

                switch (v0.c) {
                    case 1: {
                        if (v0.b == 8) {
                            arg6.a = arg5.w();
                            arg6.a(true);
                            break;
                        }

                        di.a(arg5, v0.b);
                        break;
                    }
                    case 2: {
                        if (v0.b == 11) {
                            arg6.b = arg5.z();
                            arg6.b(true);
                            break;
                        }

                        di.a(arg5, v0.b);
                        break;
                    }
                    case 3: {
                        if (v0.b == 12) {
                            arg6.c = new bn();
                            arg6.c.a(arg5);
                            arg6.c(true);
                            break;
                        }

                        di.a(arg5, v0.b);
                        break;
                    }
                    default: {
                        di.a(arg5, v0.b);
                        break;
                    }
                }

                label_9:
                arg5.m();
            }

            arg5.k();
            if (!arg6.e()) {
                throw new dg("Required field \'resp_code\' was not found in serialized data! Struct: " + this.toString());
            }

            arg6.l();
        }

        public void a(df arg1, cg arg2) throws cm {
            this.b(arg1, ((bp) arg2));
        }

        public void b(df arg2, bp arg3) throws cm {
            arg3.l();
            arg2.a(bp.m());
            arg2.a(bp.n());
            arg2.a(arg3.a);
            arg2.c();
            if (arg3.b != null && (arg3.h())) {
                arg2.a(bp.o());
                arg2.a(arg3.b);
                arg2.c();
            }

            if (arg3.c != null && (arg3.k())) {
                arg2.a(bp.q());
                arg3.c.b(arg2);
                arg2.c();
            }

            arg2.d();
            arg2.b();
        }

        public void b(df arg1, cg arg2) throws cm {
            this.a(arg1, ((bp) arg2));
        }
    }

    static class b implements do0 {
        private b() {

        }

        public a a() {
            return new a();
        }

        public dn b() {
            return this.a();
        }
    }

    static class c extends dq {
        private c() {

        }

        public void a(df arg3, bp arg4) throws cm {
            ((dl) arg3).a(arg4.a);
            BitSet v0 = new BitSet();
            if (arg4.h()) {
                v0.set(0);
            }

            if (arg4.k()) {
                v0.set(1);
            }

            ((dl) arg3).a(v0, 2);
            if (arg4.h()) {
                ((dl) arg3).a(arg4.b);
            }

            if (arg4.k()) {
                arg4.c.b(arg3);
            }
        }

        public void a(df arg1, cg arg2) throws cm {
            this.a(arg1, ((bp) arg2));
        }

        public void b(df arg4, bp arg5) throws cm {
            arg5.a = ((dl) arg4).w();
            arg5.a(true);
            BitSet v0 = ((dl) arg4).b(2);
            if (v0.get(0)) {
                arg5.b = ((dl) arg4).z();
                arg5.b(true);
            }

            if (v0.get(1)) {
                arg5.c = new bn();
                arg5.c.a(arg4);
                arg5.c(true);
            }
        }

        public void b(df arg1, cg arg2) throws cm {
            this.b(arg1, ((bp) arg2));
        }
    }

    static class d implements do0 {

        private d() {

        }

        public c a() {
            return new c();
        }

        public dn b() {
            return this.a();
        }
    }

    public enum bp$e implements cn {
        RESP_CODE((short) 1, "resp_code"),
        MSG((short) 2, "msg"),
        IMPRINT((short) 3, x.N);

        private static final Map<String, bp$e> d;
        private final short e;
        private final String f;

        static {
            d = new HashMap();
            Iterator it = EnumSet.allOf(bp$e.class).iterator();
            while (it.hasNext()) {
                bp$e eVar = (bp$e) it.next();
                d.put(eVar.b(), eVar);
            }
        }

        private bp$e(short s, String str) {
            this.e = s;
            this.f = str;
        }

        public static bp$e a(int i) {
            switch (i) {
                case 1:
                    return RESP_CODE;
                case 2:
                    return MSG;
                case 3:
                    return IMPRINT;
                default:
                    return null;
            }
        }

        public static bp$e a(String str) {
            return d.get(str);
        }

        public static bp$e b(int i) {
            bp$e a = a(i);
            if (a != null) {
                return a;
            }
            throw new IllegalArgumentException("Field " + i + " doesn't exist!");
        }

        public final short a() {
            return this.e;
        }

        public final String b() {
            return this.f;
        }
    }


    public int a;
    public String b;
    public bn c;
    public static final Map d;
    private static final long e = -4549277923241195391L;
    private static final dk f;
    private static final da g;
    private static final da h;
    private static final da i;
    private static final Map<Class<? extends dn>, do0> j;
    private static final int k = 0;
    private byte l;
    private bp$e[] m;

    static {
        f = new dk("Response");
        g = new da("resp_code", (byte) 8, (short) 1);
        h = new da("msg", (byte) 11, (short) 2);
        i = new da("imprint", (byte) 12, (short) 3);
        HashMap v0 = new HashMap();
        j = ((Map) v0);
        ((Map) v0).put(dp.class, new b());
        j.put(dq.class, new d());
        EnumMap v0_1 = new EnumMap(e.class);
        ((Map) v0_1).put(bp$e.RESP_CODE, new cs("resp_code", (byte) 1, new ct((byte) 8)));
        ((Map) v0_1).put(bp$e.MSG, new cs("msg", (byte) 2, new ct((byte) 11)));
        ((Map) v0_1).put(bp$e.IMPRINT, new cs("imprint", (byte) 2, new cx((byte) 12, bn.class)));
        d = Collections.unmodifiableMap(((Map) v0_1));
        cs.a(bp.class, bp.d);
    }

    public bp() {
        this.l = 0;
        this.m = new bp$e[]{bp$e.MSG, bp$e.IMPRINT};
    }

    public bp(int arg2) {
        this();
        this.a = arg2;
        this.a(true);
    }

    public bp(bp arg4) {
        this.l = 0;
        this.m = new bp$e[]{bp$e.MSG, bp$e.IMPRINT};
        this.l = arg4.l;
        this.a = arg4.a;
        if (arg4.h()) {
            this.b = arg4.b;
        }

        if (arg4.k()) {
            this.c = new bn(arg4.c);
        }
    }

    public void a(boolean arg3) {
        this.l = cd.a(this.l, 0, arg3);
    }

    private void a(ObjectInputStream arg3) throws IOException, ClassNotFoundException {
        try {
            this.l = 0;
            this.a(new cz(new dr(((InputStream) arg3))));
            return;
        } catch (cm v0) {
            throw new IOException(v0.getMessage());
        }
    }

    public void a(df arg3) throws cm {
        bp.j.get(arg3.D()).b().b(arg3, ((cg) this));
    }

    private void a(ObjectOutputStream arg3) throws IOException {
        try {
            this.b(new cz(new dr(((OutputStream) arg3))));
            return;
        } catch (cm v0) {
            throw new IOException(v0.getMessage());
        }
    }

    public bp a() {
        return new bp(this);
    }

    public bp a(int arg2) {
        this.a = arg2;
        this.a(true);
        return this;
    }

    public bp a(bn arg1) {
        this.c = arg1;
        return this;
    }

    public bp a(String arg1) {
        this.b = arg1;
        return this;
    }

    public void b(df arg3) throws cm {
        bp.j.get(arg3.D()).b().a(arg3, ((cg) this));
    }

    public cn b(int arg2) {
        return (cn) this.c(arg2);
    }

    public void b() {
        this.a(false);
        this.a = 0;
        this.b = null;
        this.c = null;
    }

    public void b(boolean arg2) {
        if (!arg2) {
            this.b = null;
        }
    }

    public bp$e c(int arg2) {
        return bp$e.a(arg2);
    }

    public int c() {
        return this.a;
    }

    public void c(boolean arg2) {
        if (!arg2) {
            this.c = null;
        }
    }

    public void d() {
        this.l = cd.b(this.l, 0);
    }

    public boolean e() {
        return cd.a(this.l, 0);
    }

    public String f() {
        return this.b;
    }

    public void g() {
        this.b = null;
    }

    public boolean h() {
        boolean v0 = this.b != null ? true : false;
        return v0;
    }

    public bn i() {
        return this.c;
    }

    public void j() {
        this.c = null;
    }

    public boolean k() {
        boolean v0 = this.c != null ? true : false;
        return v0;
    }

    public void l() throws cm {
        if (this.c != null) {
            this.c.m();
        }
    }

    static dk m() {
        return bp.f;
    }

    static da n() {
        return bp.g;
    }

    static da o() {
        return bp.h;
    }

    public cg p() {
        return this.a();
    }

    static da q() {
        return bp.i;
    }

    public String toString() {
        StringBuilder v0 = new StringBuilder("Response(");
        v0.append("resp_code:");
        v0.append(this.a);
        if (this.h()) {
            v0.append(", ");
            v0.append("msg:");
            if (this.b == null) {
                v0.append("null");
            } else {
                v0.append(this.b);
            }
        }

        if (this.k()) {
            v0.append(", ");
            v0.append("imprint:");
            if (this.c == null) {
                v0.append("null");
            } else {
                v0.append(this.c);
            }
        }

        v0.append(")");
        return v0.toString();
    }
}

